# RT-Thread building script for component
import rtconfig
Import('RTT_ROOT')
from building import *

cwd = GetCurrentDir()
src = Split('''
Device/ST/STM32H7xx/Source/Templates/system_stm32h7xx.c
''')
CPPPATH = [cwd + '/Device/ST/STM32H7xx/Include', cwd + '/Include']

if GetDepend(['SOC_STM32H750VB']): 
    STM32_TYPE = 'STM32H750xx'
    
CPPDEFINES = [STM32_TYPE]

# add for startup script 
if rtconfig.CROSS_TOOL == 'gcc':
    folder = 'gcc'
elif rtconfig.CROSS_TOOL == 'keil':
    folder = 'arm'
elif rtconfig.CROSS_TOOL == 'iar':
    folder = 'iar'

#Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32h750xx.s     
src += ['Device/ST/STM32H7xx/Source/Templates/' + folder + '/startup_' + STM32_TYPE.lower() + '.s']

group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)

Return('group')
